package itsm.isperp.module.controller;

import itsm.isperp.framework.core.context.ContextHolder;
import itsm.isperp.module.entity.app.AppUserCustomStyle;
import itsm.isperp.module.service.app.AppMenuService;
import itsm.isperp.module.service.app.AppUserCustomStyleService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * 
 * 
 * @author lizx
 * @date 2013-10-15
 * @version V1.0
 */
@Controller
@RequestMapping("desktop")
public class DesktopController {

	@Autowired
	AppMenuService appMenuService;
	@Autowired
	AppUserCustomStyleService appUserCustomStyleService;
 
	/**
	 * 构造菜单的路径
	 * 
	 * @param id
	 *            模块菜单id
	 * @return
	 */
	@RequestMapping(value = "", method = RequestMethod.GET)
	public ModelAndView desktop() {
		ModelAndView mv = new ModelAndView("desktop");
		AppUserCustomStyle cs = appUserCustomStyleService
				.findByUsername(ContextHolder.getLoginUsername());
		if (cs != null)
			mv.addObject("styleKey", cs.getStyleKey());
		mv.addObject("companyName", ContextHolder.getConfigByKey("companyName"));
		return mv;

	}

}
